//
// Created by Administrator on 2024/4/23.
//

#include <iostream>
using namespace std;

int main()
{
    int n = 100;
    n = 1152761; // out: 89503
    n = 1000000; //78498 循环2197839次
//    n = 1740948; // out: 130971
//    n = 2795431; // out: 203047
    int count = 0;
    bool isP[n+1]={0};
    for (int i = 2; i < n+1; ++i)
        isP[i]=1;
    for (int i = 2; i*i <= n+1; ++i)
    {
        if(isP[i])
        {
            for (int j = i+i; j < n+1 ; j+=i)
            {
                isP[j]=0;
                ++count;
            }
        }
    }
    int ret=0;
    for (int i = 0; i < n+1; ++i)
    {
        if(isP[i])
            ++ret;
    }
    cout<<count<<endl;
    cout<<ret;
    return 0;
}